//
// Created by ZLY on 2025/5/11.
//

#ifndef WEAPON_H
#define WEAPON_H
#include "../core/object.h"
class Actor;
class Spell;

class Weapon : public Object {
protected:
    Actor *parent_ = nullptr;
    float cooldown_ = 1.0f;
    float mana_cost_ = 0.0f;
    float cooldown_timer_ = 0.0f;

public:
    void update(float dt) override;

    void attack(glm::vec2 position, Spell *spell);

    bool canAttack() const;

    void setCooldown(float cooldown) {
        this->cooldown_ = cooldown;
    }

    void setManaCost(float mana_cost) {
        this->mana_cost_ = mana_cost;
    }

    void setCooldownTimer(float cooldown_timer) {
        this->cooldown_timer_ = cooldown_timer;
    }

    void setParent(Actor *parent) {
        this->parent_ = parent;
    }

    float getCooldown() const { return cooldown_; }
    float getManaCost() const { return mana_cost_; }
    float getCooldownTimer() const { return cooldown_timer_; }
    Actor *getParent() const { return parent_; }
};


#endif //WEAPON_H
